package com.example.informationEntry.service.impl;

import com.example.informationEntry.dao.NaStudentInformationDao;
import com.example.informationEntry.entity.NaStudentInformation;
import com.example.informationEntry.service.NaStudentInformationService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * 学生信息表(NaStudentInformation)表服务实现类
 *
 * @author makejava
 * @since 2019-04-08 11:20:34
 */
@Service("naStudentInformationService")
public class NaStudentInformationServiceImpl implements NaStudentInformationService {
    @Resource
    private NaStudentInformationDao naStudentInformationDao;

    /**
     * 通过ID查询单条数据
     *
     * @param studentId 主键
     * @return 实例对象
     */
    @Override
    public NaStudentInformation queryById(String studentId) {
        return this.naStudentInformationDao.queryById(studentId);
    }

    /**
     * 查询多条数据
     *
     * @param semesterNumber 学期截取
     * @return 对象列表
     */
    @Override
    public Map<String, String> queryMaxNumber(String semesterNumber) {
        return this.naStudentInformationDao.queryMaxNumber(semesterNumber);
    }

    /**
     * 查询多条数据
     *
     * @param naStudentInformation 实例对象
     * @return list集合
     */
    @Override
    public List<NaStudentInformation> queryAll(NaStudentInformation naStudentInformation) {
        return this.naStudentInformationDao.queryAll(naStudentInformation);
    }

    /**
     * 新增数据
     *
     * @param naStudentInformation 实例对象
     * @return 实例对象
     */
    @Override
    public NaStudentInformation insert(NaStudentInformation naStudentInformation) {
        this.naStudentInformationDao.insert(naStudentInformation);
        return naStudentInformation;
    }

    /**
     * 修改数据
     *
     * @param naStudentInformation 实例对象
     * @return 实例对象
     */
    @Override
    public NaStudentInformation update(NaStudentInformation naStudentInformation) {
        this.naStudentInformationDao.update(naStudentInformation);
        return this.queryById(naStudentInformation.getStudentNumber());
    }

    /**
     * 通过主键删除数据
     *
     * @param studentId 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(String studentId) {
        return this.naStudentInformationDao.deleteById(studentId) > 0;
    }


    @Override
    public int queryByCount(NaStudentInformation naStudentInformation) {
        return this.naStudentInformationDao.queryByCount(naStudentInformation);
    }
}